package com.scau.XFourPOS.model;

import java.util.Date;
import java.util.Random;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;
import javax.persistence.Table;

/**     
 * 类名称：SaleReturn
 * 类描述：退货表
 * 创建人：庄祥鹏
 * */
@Entity
@Table(name = "sale_return")
public class SaleReturn {
	
	public SaleReturn(){
		Random random = new Random();
		this.saleReturnNO="XF-RETURN"+"-"+String.valueOf((new Date()).getTime())+"-"+random.nextInt(1000);
		this.createDateTime=new Date();
		this.total=0;
	}
	
	@Id
	@Column(unique=true,nullable=false)
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	private int id;
	
	@Column(name="sale_return_NO",length=50,unique=true)
	private String saleReturnNO;
	
	@OneToOne  
	@JoinColumn(name="sale_order_id")
	private SaleOrder saleOrder;
	
	@Column(length=10)
	private double total;
	
	@Column(name="create_date_time",length=50)
	private Date createDateTime;
	
	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getSaleReturnNO() {
		return saleReturnNO;
	}

	public void setSaleReturnNO(String saleReturnNO) {
		this.saleReturnNO = saleReturnNO;
	}

	public SaleOrder getSaleOrder() {
		return saleOrder;
	}

	public void setSaleOrder(SaleOrder saleOrder) {
		this.saleOrder = saleOrder;
	}

	public double getTotal() {
		return total;
	}

	public void setTotal(double total) {
		this.total = total;
	}

	public Date getCreateDateTime() {
		return createDateTime;
	}

	public void setCreateDateTime(Date createDateTime) {
		this.createDateTime = createDateTime;
	}
	
	
}
